package com.fcscs.cservice.domain.validator;

import com.fcscs.core.common.ErrorEnums;
import com.fcscs.core.common.FieldValidators;
import com.fcscs.core.domain.validator.BaseValidator;
import com.fcscs.cservice.domain.RC;
import com.fcscs.cservice.domain.ReservationBase;

public interface ReservationValidators {

	public static class RCValidator  extends BaseValidator<RC> {
		public ErrorEnums validate(RC entity, boolean newInstance) {
			ErrorEnums err = super.validate(entity, newInstance);
			if (err != null) {
				return err;
			} else {
				if (entity.getReservationId() <= 0 || entity.getGuestProfileId() <= 0 || entity.getPaymentMethodId() <= 0
						|| entity.getStatusEnum() == null || entity.getDirectBillCodeId() <= 0 || entity.getDirectBillCodeId() <= 0
						|| FieldValidators.isNullEmptyStr(entity.getGuarantee())) {
					return ErrorEnums.GeneralError.REQURIED_FLD_MISSING;
				}
			}
			return null;
		}
	}

	public static class ReservationValidator  extends BaseValidator<ReservationBase> {
		public ErrorEnums validate(ReservationBase entity, boolean newInstance) {
			ErrorEnums err = super.validate(entity, newInstance);
			if (err != null) {
				return err;
			} else {
				if (entity.getGuestProfileId() <= 0 || entity.getReservationStatusId() <= 0 || entity.getNumberOfGuest() < 0
						|| entity.getNumberOfBaggage() < 0) {
					return ErrorEnums.GeneralError.REQURIED_FLD_MISSING;
				}
			}
			return null;
		}
	}
}
